package com.atguigu.schedule.service.impl;

import com.atguigu.schedule.POJO.SysUser;
import com.atguigu.schedule.dao.SysUesrDao;
import com.atguigu.schedule.dao.impl.SysUesrDaoImpl;
import com.atguigu.schedule.service.SysScheduleService;
import com.atguigu.schedule.service.SysUserService;
import com.atguigu.schedule.util.MD5Util;

import java.sql.SQLException;

public class SysUserServiceImpl implements SysUserService {
    private SysUesrDao sysUesrDao = new SysUesrDaoImpl();
    @Override
    public int regist(SysUser sysUser) throws SQLException {
        //将密码进行md5加密
        sysUser.setUserPwd(MD5Util.encrypt(sysUser.getUserPwd()));
        //获取返回值
        return sysUesrDao.addUser(sysUser);
    }

    @Override
    public SysUser login(SysUser sysUser) {
        return sysUesrDao.findByUsername(sysUser);
    }
}
